<table class="statistike" width="500">
   <tr>
      <td style="font-size: 18px; font-weight: bold;">
         Opšti uspeh učenika na kraju prvog polugodišta
      </td>
   </tr>
</table>

<table class="statistike" cellspacing="0" cellpadding="0" border="1" width="1050" style="border-collapse: collapse; empty-cells: show;">
   <tr>
    <th rowspan="3">Ukupan br. učenika</th>
    <th rowspan="3">Prosek</th>
    <th colspan="8">Pozitivan uspeh</th>
    <th colspan="2" rowspan="2">Svega pozitivnih</th>
    <th colspan="6">Nedovoljan uspeh</th>
    <th colspan="2" rowspan="2">Svega nedovoljnih</th>
    <th colspan="2" rowspan="2">Neocenjenih</th>
    <th colspan="2" rowspan="2">Izostanci</th>
  </tr>

  <tr>
    <th colspan="2">Odličnih</th>
    <th colspan="2">Vr. dobrih</th>
    <th colspan="2">Dobrih</th>
    <th colspan="2">Dovoljnih</th>
    <th colspan="2">Sa 1 nedov.</th>
    <th colspan="2">Sa 2 nedov.</th>
    <th colspan="2">Sa 3 i više nedov.</th>
  </tr>

  <tr>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>Opr.</th>
    <th>Neopra.</th>
  </tr>

  <tr>
    <td><?php echo $ukupno_ucenika ?></td>
    <td><?php echo $prosek_all ?></td>
    <td><?php echo $string_all['odlican'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['odlican'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['vrlodobar'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['vrlodobar'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['dobar'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['dobar'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['dovoljan'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['dovoljan'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['odlican'] + $string_all['vrlodobar'] + $string_all['dobar'] + $string_all['dovoljan'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format(($string_all['odlican'] + $string_all['vrlodobar'] + $string_all['dobar'] + $string_all['dovoljan']) / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['1kec'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['1kec'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['2kec'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['2kec'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['3kec'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['3kec'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['1kec'] + $string_all['2kec'] + $string_all['3kec'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format(($string_all['1kec'] + $string_all['2kec'] + $string_all['3kec']) / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $string_all['neocenjen'] ?></td>
    <td><?php echo ($ukupno_ucenika) ? number_format($string_all['neocenjen'] / $ukupno_ucenika * 100, 0) : '0' ?></td>
    <td><?php echo $opr ?></td>
    <td><?php echo $neopr ?></td>
  </tr>
</table>

<table class="statistike" width="600">
   <tr>
      <td style="font-size: 18px; font-weight: bold;">
         Uspeh učenika po odeljenjima na kraju prvog polugodišta
      </td>
   </tr>
</table>

<table class="statistike" cellspacing="0" cellpadding="0" border="1" width="1050" style="border-collapse: collapse; empty-cells: show;">
   <tr>
    <th rowspan="2">Odeljenje</th>
    <th rowspan="2">Prosek</th>
    <th colspan="2">Odličnih</th>
    <th colspan="2">Vr. dobrih</th>
    <th colspan="2">Dobrih</th>
    <th colspan="2">Dovoljnih</th>
    <th colspan="2">Sa 1 nedov.</th>
    <th colspan="2">Sa 2 nedov.</th>
    <th colspan="2">Sa 3 i više nedov.</th>
    <th colspan="2">Neocenjenih</th>
  </tr>

  <tr>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
    <th>br.</th>
    <th>%</th>
  </tr>

  <?php foreach($razred_podataks as $razred_id => $razred_podatak)
  {?>
  <tr>
    <td><?php echo $razred_podatak[0]?></td>
    <td><?php echo number_format($number_razred[$razred_id], 2) ?></td>
    <td><?php echo $proseks[$razred_id]['odlican'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['odlican'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['vrlodobar'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['vrlodobar'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['dobar'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['dobar'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['dovoljan'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['dovoljan'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['1kec'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['1kec'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['2kec'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['2kec'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['3kec'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['3kec'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
    <td><?php echo $proseks[$razred_id]['neocenjen'] ?></td>
    <td><?php echo ($razred_podatak[1]) ? number_format($proseks[$razred_id]['neocenjen'] / $razred_podatak[1] * 100, 0) : '0' ?></td>
  </tr>
  <?php }?>

</table>

<table class="statistike" width="600">
   <tr>
      <td style="font-size: 18px; font-weight: bold;">
         Rang razreda po uspehu na kraju prvog polugodišta
      </td>
   </tr>
</table>

<table class="statistike" cellspacing="0" cellpadding="0" border="1" width="400" style="border-collapse: collapse; empty-cells: show;">
  <tr>
    <th style="width: 50px;">RBR</th>
    <th style="width: 80px;">Razred</th>
    <th style="width: 80px;">Prosek</th>
  </tr>

  <?php
  $i = 0;
  foreach($number_razred as $razred_id => $n_r)
  {
     $i ++;?>
  <tr>
    <td><?php echo $i ?></td>
    <td><?php echo $razred_podataks[$razred_id][0] ?></td>
    <td><?php echo number_format($n_r, 2) ?></td>
  </tr>
  <?php }?>
</table>

<br />
<?php if(!$sf_request->getParameter('print_verzija'))
{?>
   <table class="statistike" width="100">
      <tr>
         <td>
            <?php echo link_to('Print verzija', 'statistike/zakljucne?skola_id='.$sf_request->getParameter('skola_id').'&period='.$sf_request->getParameter('period').'&print_verzija=1', array('onclick' => 'popup(this.href, "10-1. Kretanje broja učenika u toku školske godine", 1024, 800); return false;', 'style' => 'color: blue;')) ?>
         </td>
      </tr>
   </table>
   <?php }?>
